package com.haiyou.data.common.accessor.rsync;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.google.common.collect.Sets;
import com.haiyou.common.entity.Entity;

public interface Flusher<K extends Serializable & Comparable<K>, V extends Entity<K>> {

	default void giveUp(K key) {
		giveUp(Sets.newHashSet(key));
	}

	void giveUp(Iterable<? extends K> keys);

	default void flush(K key, V value) {
		flush(new HashMap<K, V>() {
			{
				put(key, value);
			}
		});
	}

	void flush(Map<? extends K, ? extends V> map);

}
